#include <stdio.h>
#include <string.h>
#include <math.h>

main()
{
	int n,i;
	double dis=0;
	double time[30]={0};
	int one;
	double hh=0,mm=0,ss=0;
	double tot=0;
	char in[1000];
	int find;
	
//	find=(int)(2.9);
//	printf("%d",find);

	scanf("%d %lf",&n, &dis);
	while (scanf("%d", &one)!=EOF)
	{
		tot=0;
		find=0;
		for (i=1;i<=n;i++)
		{
			scanf("%s",in);
			if (in[0]=='-') find=1;
			if (!find) 
			{
				sscanf(in,"%lf:%lf:%lf", &hh, &mm, &ss);
				time[i]=hh*60*60+mm*60+ss;
				tot+=time[i];
			}			
		}		
		tot/=dis;
		ss=tot-((int)(tot/60))*60;
		mm=(tot-ss)/60;
		if (ss>=59.5)
		{
			ss=0;
			mm=mm+1;
		}
		

		
//		int outm,outs,otot;
//		otot=(int)(tot+0.5);
//		outm=otot/60;
//		outs=otot%60;
		

		if (!find) 
		{
		
			printf("%3d: ", one);
			printf("%.0lf:", mm);
			if (ss<9.5) printf("0");			
			printf("%.0lf min/km\n", ss);
		}			
		else
		{
			printf("%3d: -\n",one);
		}
		
		
		
		

	}
	



	return 0;
}
